package qdu.edu.com.fushanf4.service.count.usertype.search2characters.splicingtwocharacters;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import qdu.edu.com.fushanf4.utils.ConfigurationUtil;
import qdu.edu.com.fushanf4.utils.DriverUtil;

import java.io.IOException;

/**
 * 将两个高频的汉字拼接在一起，查询原始数据中的拼接在一起的汉字出现的次数
 */
public class SplicingTwoCharactersDriver extends DriverUtil {
    public static void main(String[] args) throws IOException {
        SplicingTwoCharactersDriver searchTwoCharactersDriver = new SplicingTwoCharactersDriver();
        searchTwoCharactersDriver.run(args);
    }

    @Override
    public Job runJob(String[] path) throws IOException {
        Job job = ConfigurationUtil.getJob();

        // 设置Driver
        job.setJarByClass(SplicingTwoCharactersDriver.class);
        // 设置MapReduce类
        job.setMapperClass(SplicingTwoCharactersMapper.class);
        job.setReducerClass(SplicingTwoCharactersReducer.class);
        //设置Map输出
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(NullWritable.class);
        //设置最后的输出
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(NullWritable.class);

        ConfigurationUtil.setPathAndRunJob(path,job);
        return job;
    }
}
